<!DOCTYPE html>
<html>

<head lang="en">
    <meta charset="UTF-8">
    <title>DuangDuang玩 - 秀出你自己的影视特效</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="alternate icon" type="image/png" href="__PUBLIC__/i/favicon.png">
    <link rel="stylesheet" href="http://cdn.amazeui.org/amazeui/2.4.2/css/amazeui.min.css" />
    <style>
    .footer p {
        color: #7f8c8d;
        margin: 0;
        padding: 15px 0;
        text-align: center;
        background: #2d3e50;
    }
    </style>
</head>

<body>
    <header class="am-topbar am-topbar-fixed-top">
        <div class="am-container">
            <h1 class="am-topbar-brand">
      <a href="{:U('Home/Index/index')}">DuangDuang玩</a>
    </h1>
            <button class="am-topbar-btn am-topbar-toggle am-btn am-btn-sm am-btn-secondary am-show-sm-only" data-am-collapse="{target: '#collapse-head'}"><span class="am-sr-only">导航切换</span> <span class="am-icon-bars"></span></button>
            <div class="am-collapse am-topbar-collapse" id="collapse-head">
                <ul class="am-nav am-nav-pills am-topbar-nav">
                    <li><a href="{:U('Home/Index/index')}">网站首页</a></li>
                    <li class="am-active"><a href="{:U('Home/Projects/index')}">视频项目</a></li>
                    <li><a href="{:U('Home/About/index')}">关于我们</a></li>
                    <li><a href="{:U('Home/User/index')}">用户中心</a></li>
                </ul>
                <div class="am-topbar-right">
                    <button onclick="window.location.href='{$button2url}';" class="am-btn am-btn-secondary am-topbar-btn am-btn-sm"><span class="am-icon-pencil"></span> {$button2title}</button>
                </div>
                <div class="am-topbar-right">
                    <button onclick="window.location.href='{$button1url}';" class="am-btn am-btn-primary am-topbar-btn am-btn-sm"><span class="am-icon-user"></span> {$button1title}</button>
                </div>
            </div>
        </div>
    </header>
    <div class="am-g am-container ">
       <h1>您正在给《{$ptitle}》投稿</h1>
    </div>
    <div class="am-container">
        <div id="youku-upload">
            <div class="am-form">
                <form role="form" name="video-upload">
                    <fieldset>
                        <div class="am-form-group">
                            <label for="spanSWFUploadButton">选择文件：</label>
                            <div id="uploadControl"></div>
                        </div>
                        <div class="am-form-group">
                            <label for="input01">标题：</label>
                            <div class="controls">
                                <input type="text" class="input-xlarge" id="input01" name="title">
                            </div>
                        </div>
                        <div class="am-form-group">
                            <label for="textarea">简介：</label>
                            <div class="controls">
                                <textarea class="input-xlarge" id="textarea" rows="3" name="description"></textarea>
                            </div>
                        </div>
                        <div class="am-form-group">
                            <label for="input02">标签：</label>
                            <div class="controls">
                                <input type="text" class="input-xlarge" id="input02" name="tags">
                                <span class="help-inline"></span>
                            </div>
                        </div>
                        <div class="am-form-group">
                            <label for="category-node">类别：</label>
                            <div class="controls">
                                <select id="category-node" name="category"></select>
                            </div>
                        </div>
                        <div class="am-form-group">
                            <input type="hidden" name="copyright_type" id="copyright_type2" value="original">
                            <input type="hidden" name="public_type" id="public_type1" value="all">
                        </div>
                        <!--
                        <div class="am-form-group">
                            <label>版权所有</label>
                            <div class="controls">
                                <label class="radio inline">
                                    <input type="radio" name="copyright_type" id="copyright_type2" value="original" checked="">原创
                                </label>
                                <label class="radio inline">
                                    <input type="radio" name="copyright_type" id="copyright_type1" value="reproduced">转载
                                </label>
                            </div>
                        </div>
                        <div class="am-form-group">
                            <label>视频权限</label>
                            <div class="controls">
                                <label class="radio inline">
                                    <input type="radio" name="public_type" id="public_type1" value="all" checked="">公开
                                </label>
                                <label class="radio inline">
                                    <input type="radio" name="public_type" id="public_type2" value="friend">仅好友
                                </label>
                                <label class="radio inline">
                                    <input type="radio" name="public_type" id="public_type3" value="password">输入密码观看
                                </label>
                                <label class="radio inline" style="display:none" id="passwrod">
                                    <input type="text" class="input " name="watch_password">
                                </label>
                            </div>
                        </div>
                        -->
                        <div class="form-actions">
                            <button type="submit" class="am-btn am-btn-default" id="btn-upload-start">
                                <i class="icon-upload icon-white"></i>
                                <span>开始上传</span>
                            </button>
                        </div>
                    </fieldset>
                </form>
                <div class="row">
                    <div class="span5" id="upload-status-wraper"></div>
                </div>
                <br>
                <div>
                    <h3>说明</h3>
                    <ul class="am-list">
                        <li>最大支持上传<strong>1 GB</strong> 视频文件</li>
                        <li>允许上传的视频格式为：wmv,avi,dat,asf,rm,rmvb,ram,mpg,mpeg,3gp,mov,mp4,m4v,dvix,dv,dat,</br>mkv,flv,vob,ram,qt,divx,cpk,fli,flc,mod。不符合格式的视频将会被丢弃，请确保视频格式的正确性，避免上传失败</li>
                        <li></li>
                    </ul>
                </div>
            </div>
            <!--完成上传的DOM和登录DOM 开始-->
            <div id="complete"></div>
            <div id="login" style="width:100%;height:100%;position:fixed;z-index:999;left:0px;top:0px;overflow:hidden;display:none;">
            </div>
            <!--完成上传的DOM和登录DOM 结束-->
        </div>
    </div>
    <footer class="footer">
        <p>© 2015 <a href="http://www.duangduangwan.cn" target="_blank">DuangDuang玩</a> by the KKQY</p>
    </footer>
    <!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="http://cdn.amazeui.org/amazeui/2.4.2/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->
    <!--[if (gte IE 9)|!(IE)]><!-->
    <script src="http://cdn.staticfile.org/jquery/2.1.0/jquery.js"></script>
    <!--<![endif]-->
    <script src="http://cdn.amazeui.org/amazeui/2.4.2/js/amazeui.min.js"></script>
    <script src="http://open.youku.com/assets/lib/uploadjs.php"></script>
    <script>
    //document.domain = "youku.com";
    var USE_STREAM_UPLOAD = true;
    jQuery(document).ready(function() {
        //Oauth授权的三种页面跳转方式iframe,newWindow,currentWindow
        //iframe跳转方式
        var param = {
            client_id: "78cb1297cad3da80",
            access_token: "{$access_token}",
            oauth_opentype: "iframe",
            oauth_redirect_uri: "http://www.duangduangwan.cn/index.php/Home/User/upload.html",
            oauth_state: "",
            completeCallback: "uploadComplete",
            categoryCallback: "categoryLoaded"
        };
        youkuUploadInit(param);

    });
    //上传完成时回调方法
    function post(URL, PARAMS) {
        var temp = document.createElement("form");
        temp.action = URL;
        temp.method = "post";
        temp.style.display = "none";
        for (var x in PARAMS) {
            var opt = document.createElement("textarea");
            opt.name = x;
            opt.value = PARAMS[x];
            // alert(opt.name)      
            temp.appendChild(opt);
        }
        document.body.appendChild(temp);
        temp.submit();
        return temp;
    }


    function uploadComplete(data) {
        post('{:U("Home/Video/uploadComplete")}', {
            yid: data.videoid,
            vtitle: data.title,
            pid: {$pid}
        });
    }

    //分类加载后回调方法
    function categoryLoaded(data) {
        if (data.categories) {
            var tpl = '';
            for (var i = 0; i < data.categories.length; i++) {
                if (data.categories[i].term == 'Ads') {
                    tpl += '<option value="' + data.categories[i].term + '" selected>' + data.categories[i].label + '</option>';
                } else {
                    tpl += '<option value="' + data.categories[i].term + '" >' + data.categories[i].label + '</option>';
                }
            }
            $("#category-node").html(tpl);
        }
    }
    </script>
</body>

</html>
